#include <stdio.h>
#include <stdlib.h>


typedef struct mynode
{
	int data;
	int pos;
	struct mynode *next;
}linknode;

linknode *creat(int yushu)
{
	linknode *H=malloc(sizeof(linknode));
	H->data=yushu;
	H->pos=-1;
	H->next=NULL;

	return H;
}

int tailinsert(linknode *H,int indata,int dpos)
{
	linknode *Q=H;
	while(Q->next!=NULL)
	{
		Q=Q->next;
	}
	linknode *p=malloc(sizeof(linknode));
	p->data=indata;
	p->pos=dpos;
	p->next=NULL;
	Q->next=p;

	return 0;
}


int hashfind(linknode *H,int num)
{
	while(H->next!=NULL)
	{
		H=H->next;
		if(H->data==num)
		{
			return H->pos;
		}
	}
	return -1;
}
int main(int argc, const char *argv[])
{
	int arr[10]={1,3,5,7,9,2,4,6,8,0};
	int key=10;
	linknode *linkarr[10];
	int i=0;
	for(i=0;i<10;i++)
	{
		linkarr[i]=creat(i);
	}
	for(i=0;i<10;i++)
	{
		tailinsert(linkarr[arr[i]%key],arr[i],i);
	}
	printf("plz input you will find num>>\n");
	int findnum=0;
	scanf("%d",&findnum);
	int ret = hashfind(linkarr[findnum%10],findnum);
	if(ret>=0)
	{
		printf("yes pos = %d \n",ret);		
	}
	else
	{
		printf("no\n");
	}
	return 0;
}
